package com.cris.domain;

public class Money {
	private double amount;
	private String currency;
	public Money(){
		this.currency = "RMB";
		this.amount = 0;
	}
	public Money(double amount){
		this.currency = "RMB";
		this.amount = amount;
	}
	public Money(double amount, String currency) {
		super();
		this.amount = amount;
		this.currency = currency;
	}
	public double getAmount() {
		return amount;
	}
	public void setAmount(double amount) {
		this.amount = amount;
	}
	public String getCurrency() {
		return currency;
	}
	public void setCurrency(String currency) {
		this.currency = currency;
	}
	public Money times(int quantity){
		double temp = this.getAmount()*quantity;
		this.setAmount(temp);
		return this;		
	}
	public Money add(Money subtotal){
		double temp = this.getAmount()+subtotal.getAmount();
		this.setAmount(temp);
		return this;		
	}
	public Money minus(Money total){
		double temp = this.getAmount()-total.getAmount();
		this.setAmount(temp);
		return this;		
	}
	public boolean equals(Money money){
		boolean flag = false;
		if (this.amount == money.getAmount())
			flag = true;
		return flag;			
	}
}
